
Ext.define('app.controller.ChangeSmsPwdController', {
			extend : 'Ext.app.Controller',
			refs : [{
						ref : 'ViewChangeSmsPwdWindow',
						selector : 'ViewChangeSmsPwdWindow'// getIndexGridViewGrid
					}],
			stores : [],
			init : function() {
				this.control({
							'button[name=submitButton]' : {
								click : function(o) {
									this.onEditChangeSmsPwd(o);
								}
							}
						});
			},
			onLaunch : function() {
				Ext.widget('ViewChangeSmsPwdWindow', {
								animateTarget : document.body
							}).show();
			},
			onEditChangeSmsPwd:function(o){
				var items=this.getViewChangeSmsPwdWindow().items;
				if(items.items[0].items.items[0].getValue()==""||items.items[0].items.items[1].items.items[0].getValue()==""||items.items[0].items.items[1].items.items[1].getValue()==""){
					return;	
				}
				if(items.items[0].items.items[1].items.items[0].getValue()==items.items[0].items.items[1].items.items[1].getValue()){
					Ext.Ajax.request({
						url : "updateChangeSmsPwd.action",
						params : {
							"oldPassword" : items.items[0].items.items[0].getValue(),
							"password" : items.items[0].items.items[1].items.items[0].getValue()
						},
						success : function(respose, option) {
							var result = Ext.decode(respose.responseText);
							if (result.success) {
								alert(result.msg);
								o.ownerCt.ownerCt.close();
							} else {
								alert(result.msg);
							}
						},
						failure : function(form, action) {
							Ext.Msg.alert("提示", '出错！');
						}
					});
				}else{
					Ext.Msg.alert("提示", '两次密码不一致,请重新输入！');
				}
			}
		});
